package com.ostrich.module_home.discovery.adapter

import android.widget.ImageView
import androidx.databinding.DataBindingUtil
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CenterCrop
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ostrich.library_base.BaseViewModel
import com.ostrich.module_home.R
import com.ostrich.module_home.databinding.HomeItemDiscoveryCategoryItemSubjectCardViewBinding
import com.ostrich.module_home.discovery.entity.DiscoveryEntity

/**
 * @Author : yaotianxue
 * @Time : On 2023/10/30 15:23
 * @Description : SubjectIemAdapter
 */
class SubjectIemAdapter(val layout:Int,val list:MutableList<DiscoveryEntity>):BaseQuickAdapter<DiscoveryEntity,BaseViewHolder>(layout,list) {
    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        DataBindingUtil.bind<HomeItemDiscoveryCategoryItemSubjectCardViewBinding>(viewHolder.itemView)
    }

    override fun convert(holder: BaseViewHolder, item: DiscoveryEntity) {
        holder.getBinding<HomeItemDiscoveryCategoryItemSubjectCardViewBinding>()?.viewModel = item
        holder.getBinding<HomeItemDiscoveryCategoryItemSubjectCardViewBinding>()?.executePendingBindings()
    }
}